---
layout: "default"
title: "filter"
description: "Swift documentation for 'filter': Return an Array containing the elements of source,."
keywords: "filter,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-filter-s_-sequencetype_-s-includeelement_-s-generator-element-bool">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-filter-s_-sequencetype_-s-includeelement_-s-generator-element-bool">func <wbr>filter&lt;S : SequenceType&gt;(<wbr>_:<wbr> S, includeElement: (S.Generator.Element) -&gt; Bool)</a>
        
<div class="comment collapse" id="comment-func-filter-s_-sequencetype_-s-includeelement_-s-generator-element-bool"><div class="p">
    <p>Return an <code>Array</code> containing the elements of <code>source</code>,
in order, that satisfy the predicate <code>includeElement</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func filter&lt;S : SequenceType&gt;(source: S, includeElement: (S.Generator.Element) -&gt; Bool) -&gt; [S.Generator.Element]</code>
    
    
</div></div>
</div>
